package router

import (
	"github.com/gin-gonic/gin"
	"go-web/controller"
	"go-web/service"
)

func SetupRouter(r *gin.Engine) {

	user := r.Group("/users")
	{
		user.GET("/", controller.GetUsers)
		user.GET("", controller.GetUsers)
		user.GET("/:id", controller.GetUser)
		user.POST("", controller.CreateUser)
		user.PUT("/:id", controller.UpdateUser)
		user.DELETE("/:id", controller.DeleteUser)
	}

	r.POST("/shorten", controller.Shorten)
	r.GET("/:short_id", controller.Redirect)

	r.GET("/borrow/:memberId", controller.FindBookBorrowedByMemberId)
	r.GET("/borrowInfo/:memberId", controller.FindBookBorrowInfoByMemberId)

	r.GET("/ws", service.WsHandler)
}
